import matplotlib.pyplot as plt
from train_transform import FoodDataset

file = 'training'
image_path = f'food11/versions/1/{file}'

dataset = FoodDataset(image_path=image_path, mode='train')
# 可视化前5张图片
plt.figure(figsize=(15, 10))
for i in range(5):
    image, _ = dataset.__getitem__(i)
    plt.subplot(1, 5, i + 1)
    plt.imshow(image.permute(2, 1, 0))  # 假设 image 是 PyTorch 张量，调整维度为 HWC
    plt.axis('off')
plt.show()